##############################################################
#Figure E3: Zillow Data Result: Hurricane Proximity and Home Values and Sales
##############################################################

#County Home Value Results
homevalue <- read.dta13("./temp/fige3adata.dta")
#County Home Sales Results
homesale <- read.dta13("./temp/fige3bdata.dta")

home <- cbind(homevalue, homesale)
home <- home[,-3]

library(tidyverse)

newdf <- home %>% 
  gather(variable, value, -var)%>%
  spread(var, value)

newdf$id <- c(1,2)

ggplot() + 
  geom_pointrange(data=newdf, mapping=aes(x=id, y=logd_coef, ymin=logd_ci_upper, 
                                          ymax=logd_ci_lower), color="black", size=1, lwd=1, fatten=2) +
  coord_flip() + 
  theme_bw() + 
  scale_x_discrete(limit=c("1", "2"), labels= c("Home Value", "Home Sales")) + 
  xlab(" ")  + ylab("Estimate") +
  geom_hline(yintercept=0, col="grey60", lwd=1, lty="dashed") + 
  theme(panel.grid.major = element_blank(),
        axis.text = element_text(size=15), 
        axis.title = element_text(size=18)) + ylim(-150,150)

ggsave("./figures/fige3.pdf")
